var Setting = {

    dropDownContent: null,

    create: function(url){
        //#settings-table
        var data='create=1';
        var method='get';
        var successFunction=function(json){
            if(json.htmlContent){
                $('#new-item').html(json.htmlContent);
                Main.openPopup($('#new-item'));
            }
        };
        var beforeFunction=function(){

        };
        var afterFunction=function(){

        };

        Ajax.sendAjax(url,data,method,successFunction,beforeFunction,afterFunction);
    },

    changeType: function(selector){
        var url=selector.attr('data-id');
        var data='type='+selector.val();
        var method='get';
        var successFunction=function(json){
            if(json.htmlContent) $('#new-item').html(json.htmlContent);
        };
        var beforeFunction=function(){

        };
        var afterFunction=function(){

        };

        Ajax.sendAjax(url,data,method,successFunction,beforeFunction,afterFunction);
    },

    createDropDownSetting: function(block){
        if(Setting.dropDownContent==null){
            Setting.dropDownContent=block.html();
        }

        if(block.hasClass('hidden')){
            block.removeClass('hidden');
        }else{
            block.parent('div').append('<div class="dropdown">'+Setting.dropDownContent+'</div>');
        }
    },

    changeDropDownSetting: function(dropDownFields,dropDown){
        if(dropDownFields.hasClass('hidden')){
            dropDownFields.removeClass('hidden');
        }
        dropDown.addClass('hidden');
    },

    deleteDropDownField: function(link){
        var url=link.attr('href');
        var divBlock=link.parent('div').parent('div');

        $.each($('input',divBlock),function(index,value){
            $(value).val('');
        });

        divBlock.addClass('hidden');

        var data='delete=1';
        var method='get';
        var successFunction=function(json){

        };
        var beforeFunction=function(){

        };
        var afterFunction=function(){

        };
        //confirm('Удалить?');
        Ajax.sendAjax(url,data,method,successFunction,beforeFunction,afterFunction);
    }
};